<?php if(isset($data)):?>
	<?php if(isset($data['boolean'])): ?>
	<div class="boolean_result sparql">
		<h2>SPARQL Boolean</h2>
		<p><?php echo ($data['boolean'])? 'TRUE' : 'FALSE'?></p>
	</div>
	<?php elseif(isset($data['results']['bindings'])): ?>
		<table class="sparql">
		<thead>
			<tr>
				<?php foreach($data['head']['vars'] as $var): ?><th><?php echo htmlentities($var)?></th><?php endforeach ?>
			</tr>
		</thead>
		<?php foreach($data['results']['bindings'] as $row): ?>
			<tr>
				<?php foreach($row as $k => $v):?>
					<td>
						<?php echo $v['value']?>
						<?php if($v['type']=='uri'):?>
							<a class="action" rel="convert" href="/?data-uri=<?php echo urlencode($v['value']) ?>">Convert</a>
						<?php endif ?>
					</td>
				<?php endforeach?>
			</tr>
		<?php endforeach ?>
		
		</table>	
	<?php endif ?>
<?php endif ?>